package com.anita.member.domain.model.member;

import lombok.Getter;

/**
 * @author qiu
 * @date 2025/10/17
 * @description
 */
@Getter
public enum Status {
    DISABLED(0, "禁用"),
    NORMAL(1, "启用"),
    FROZEN(2, "冻结");

    private final int code;
    private final String desc;

    Status(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return code;
    }

    public String desc() {
        return desc;
    }

    public static Status of(int code) {
        for (Status status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的状态码: " + code);
    }
}
